1 package cz
.brmlab
.brmtron
.client
;
3 import java
.io
.BufferedReader
;
4 import java
.io
.DataOutputStream
;
5 import java
.io
.InputStreamReader
;
6 import java
.net
.Socket
;
7 import java
.net
.UnknownHostException
;
9 import android
.util
.Log
;
11 public class ConnetionManager
{
12 private static Socket sock
;
13 private static DataOutputStream outStream
;
14 private static BufferedReader inStream
;
15 static final String LOG_TAG
= "BrmTron ConnectionManager";
17 public void ConnectionManager() {
21 public void connect(String host
, int port
) {
23 sock
= new Socket(host
, port
);
24 outStream
= new DataOutputStream(sock
.getOutputStream());
25 inStream
= new BufferedReader(new InputStreamReader(sock
.getInputStream()));
26 } catch(UnknownHostException e
) {
27 Log
.e(LOG_TAG
, "Unknown host");
28 } catch(Exception e
) {
29 Log
.e(LOG_TAG
, e
.toString());
33 public void disconnect(){
38 } catch(Exception e
) {
39 Log
.e(LOG_TAG
, e
.toString());
43 public DataOutputStream
getOutputStream() {
47 public BufferedReader
getInputReader() {